package hu.rsc.feeds.client.util;

public class EmailValidator {

    public static boolean isValid(Object value) {
	if (value == null) {
	    return true;
	}

	String emailPattern = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.(?:[a-zA-Z]{2,6})$";

	boolean valid = false;

	if (value.getClass().toString().equals(String.class.toString())) {
	    valid = ((String) value).matches(emailPattern);
	} else {
	    valid = (value).toString().matches(emailPattern);
	}

	return valid;
    }
}
